<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 工厂函数
    function createStudent(name, age, height) {
      var stu = {}
      stu.name = name
      stu.age = age
      stu.height = height
      stu.running = function () { console.log("running") }
      return stu
    }

    var stu1 = createStudent("why", 18, 1.88)
    var stu2 = createStudent("kobe", 30, 1.98)
    var stu3 = createStudent("james", 25, 2.05)
    console.log(stu1, stu2, stu3)

  </script>
</body>

</html>